import { useUserInfoStore } from '@/stores'
import { showToastAndRedirect } from '@/utils'
const userInfoStore = useUserInfoStore()
export const verifyToken = () => {

  const verifyTokenAndRedirect = () => {
    const token = userInfoStore.getToken();
    if (!token) {
      showToastAndRedirect({
        title: "未登录",
        icon: "none",
        duration: 2000,
        redirect: () => {
          uni.navigateTo({
            url: "/pages/login/login"
          });
        }
      });
      return false;
    }
    return true;
  }
  

  return { verifyTokenAndRedirect }
}
